#include "pch.h"
FramePrint::FramePrint()
{
	reset();
}

FramePrint::FramePrint(const std::string& des)
{
	reset();
	_des = des;
}

void FramePrint::setDes(const std::string& des)
{
	_des = des;
}

std::string FramePrint::getDes()
{
	std::string ret = _des + " " + strLogData + "] ";
	reset();
	return ret;
}

FramePrint::~FramePrint()
{
}

void FramePrint::reset()
{
	_frameCount = 0;
	lLogBeg = lLogEnd = GetTickCount64();
	lFrameBeg = lFrameEnd = GetTickCount64();
	strLogData = "[";
}

void FramePrint::add()
{
	_frameCount++;
	lFrameEnd = GetTickCount64();
	if (lFrameEnd - lFrameBeg >= 1000)
	{
		strLogData += " " + std::to_string(_frameCount);
		_frameCount = 0;
		lFrameBeg = lFrameEnd;
	}
}

bool FramePrint::escape()
{
	lLogEnd = GetTickCount64();
	return lLogEnd - lLogBeg >= 10000;
}